package stars;

import java.util.ArrayList;
import java.util.HashMap;

import com.jme3.scene.Node;
import com.jme3.scene.Spatial;

import model.IModel;
import model.AbstractModel;

import stars.enums.EStarMods;
import stars.enums.EStarType;
import utilities.Key;
import view.EViewList;
import view.AbstractView;
import view.IView;
import controller.AbstractController;
import controller.IController;
import controller.PhysicalEventStrategyPack;
import eventManager.AppEvent;
import eventManager.EventManager;
import eventManager.IEventData;
import eventStrategies.GetStarTypeStrategy;
import eventStrategies.ChangeViewStrategy;
import eventStrategies.SetStarTypeStrategy;
import eventStrategies.physicalModel.GetMassStrategy;
import events.ECodeEventList;
import events.physicalModel.GetLuminosityEvent;
import events.physicalModel.GetMassEvent;
import events.physicalModel.ReplyGetLuminosityEvent;
import events.physicalModel.ReplyGetMassEvent;
import events.physicalModel.SetLuminosityEvent;
import events.physicalModel.SetMassEvent;


public class StarController extends AbstractController {

	//private ArrayList<VStar> views = new ArrayList<VStar>();
	
	//private PhysicalEventStrategyPack physicalEventStrategyPack;
	//private AbstractController controller;
	
	private StarModel model;
	
	public StarController(StarModel model, ArrayList<Spatial> views) {
		super(views);
		this.model = model;
		
//		for (Spatial spatial: views) {
//			addSpatial(spatial);
//		}		
//		this.spatial = views.get(0);
				
		//load any special strategy packages here
		PhysicalEventStrategyPack.loadPhysicalEventStrategies(this, model.getPhysicalDataModel());
		//Continue...
		
		//load star-specific strategies
		loadSpecificEventStrategies();
	}	

	
	public void loadSpecificEventStrategies() {
		this.loadStrategy(new GetStarTypeStrategy());
		this.loadStrategy(new SetStarTypeStrategy());
		
//		Node baseNode = (Node) spatials.get("baseNode");		
		this.loadStrategy(new ChangeViewStrategy(spatials));
	}
		
	
//	//TODO:  Refactor into events, eventStrategies for Star class
//	public ArrayList<EStarMods> getStability() {
//		StarModel fullModel = (StarModel) this.model;
//		return fullModel.getStability();
//	}	
	
	
//	public EStarType getType() {
//	StarModel fullModel = (StarModel) model;
//	return fullModel.getType();
//}	
	
	
	
//	//IController methods
//	public void setModel(IModel model) {
//		controller.setModel(model);		
//	}
//
//	public void addView(AbstractView view) {
//		controller.addView(view);
//	}
//
//	public HashMap<EViewList, AbstractView> getViews() {
//		return controller.getViews();
//	}
//	
//
//	public HashMap<ECodeEventList, CodeEventStrategy> getEvents() {
//		return controller.getEvents();
//	}
	
//	public HashMap<ECodeEventList, CodeEventStrategy> getViewEvents() {
//		return controller.getViewEvents();
//	}
//	
//	public HashMap<ECodeEventList, CodeEventStrategy> getControllerEvents() {
//		return controller.getControllerEvents();
//	}

	
	
//	public void loadStrategy(CodeEventStrategy strategy) {
//		controller.loadStrategy(strategy);
//	}
	
//	public void loadViewStrategy(CodeEventStrategy strategy) {
//		controller.loadStrategy(strategy);
//	}
//	
//	public void loadControllerStrategy(CodeEventStrategy strategy) {
//		controller.loadStrategy(strategy);
//	}
	

//	public void processOutgoingEvent(IEventData event) {
//		controller.processOutgoingEvent(event);
//	}
//
//	public void handleEvent(IEventData event) {
//		controller.handleEvent(event);
//	}
//
//	public Key getKey() {
//		return controller.getKey();
//	}
//	
//	public void setKey(Key key) {
//		controller.setKey(key);
//	}

	

	

}
